package main

import "fmt"

type MyInt int

type struct01 struct {
	name string
	city string
	age  int
}

func main() {
	var a MyInt
	var b int
	fmt.Printf("%T\n", a)
	fmt.Printf("%T\n", b)

	//初始化方式一
	struct1 := struct01{
		name: "name",
		city: "cd",
		age:  10,
	}
	fmt.Printf("%v\n %T\n", struct1, struct1)

	//初始化方式二
	var struct2 = new(struct01)
	fmt.Printf("%v\n %T\n", struct2, struct1)

	//初始化方式三
	var struct3 = &struct01{} //可赋值
	fmt.Printf("%v\n %T\n", struct3, struct3)

	//初始化方式四
	var struct4 = struct01{} //可赋值
	fmt.Printf("%v\n %T\n", struct4, struct4)

	//初始化方式四
	var struct5 struct01
	fmt.Printf("%v\n %T\n", struct5, struct5)

	//匿名结构体   注意这里使用的时分号";"
	var user struct {
		Name string
		Age  int
	}
	user.Name = "com.dyw"
	fmt.Println(user)
}
